package com.bw.kf.all2211a.fg

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.viewModelScope
import com.bw.kf.mvvm.base.BaseRepo
import com.bw.kf.mvvm.entity.IndexEntity
import com.bw.kf.mvvm.entity.ProductEntity
import kotlinx.coroutines.launch

class FgViewMode1:BaseRepo() {
    val success=MutableLiveData<IndexEntity>()
    val fall=MutableLiveData<String>()
    fun index(){
        viewModelScope.launch {
            try {
                success.value=aPiText.index()
            }catch (e:Exception){
                fall.value=e.message
            }
        }
    }
    val successP= MutableLiveData<ProductEntity>()
    val fallP= MutableLiveData<String>()
    fun product(type:Int,limit:Int,page:Int){
        viewModelScope.launch {
            try {
                successP.value=aPiText.product(type,limit,page)
            }catch (e:Exception){
                fallP.value=e.message
            }
        }
    }
}